package homework1;

public class TennisScore implements IScore{
	public int sets1;
	public int sets2;
	
	public boolean isManGame;
	
	public TennisScore(int sets1, int sets2, boolean isManGame){
		this.sets1 = sets1;
		this.sets2 = sets2;
		this.isManGame = isManGame;
	}

	public String winner(String a, String b) {
		if( sets1 > sets2 )
			return a;
		return b;
	}

	public boolean isValid() {
		if( isManGame )
			return sets1 <= 5 && sets2 <= 5;
		
		return sets1 <= 3 && sets2 <= 3;
	}
}
